#pragma once

#include <boost\multiprecision\gmp.hpp>


namespace sdsky2
{
	/*typedef double sfloat;*/
	/*typedef boost::multiprecision::number<boost::multiprecision::backends::cpp_bin_float<20> > sfloat;*/
	typedef boost::multiprecision::number<boost::multiprecision::gmp_float<40>> sfloat;
	/*typedef boost::multiprecision::cpp_bin_float_double_extended sfloat;*/

	struct vector2d
	{
		sfloat x;
		sfloat y;
	};

	struct star
	{
		sfloat r;

		sfloat m;

		vector2d p;

		vector2d v;

		star(sfloat const & r, sfloat const & m, vector2d const & p, vector2d const & v) :
			r(r), m(m), p(p), v(v)
		{
		}
	};

	class sdsky
	{
	public:
		sdsky(sfloat const & interval);

		void add(star const & s);

		void clear();

		void update();

		std::vector<star> const & stars();

	private:
		void fps();

		long long m_lastQpc = 0;

		long long m_freq;

		int m_frames = 0;

		std::vector<star> m_stars;

		sfloat const m_interval;

		sfloat const G = 100;
	};
}